package com.itedge.solutionmanager.service.processhelper;

import org.activiti.engine.impl.context.Context;
import org.springframework.beans.factory.annotation.Autowired;

import com.itedge.infrastructure.service.domain.IProcessEntityService;
import com.itedge.infrastructure.stereotype.ProcessHelper;
import com.itedge.solutionmanager.domain.impl.Customer;
import com.itedge.solutionmanager.enumeration.CustomerStatus;

@ProcessHelper
public class CustomerProcessHelper {
	
	@Autowired
	IProcessEntityService<Customer> customerService; 
	
    public boolean isDeactivated() {
    	String currentProcId = Context.getExecutionContext().getProcessInstance().getProcessInstanceId();
        Customer linkedCustomer = customerService.findEntityByProcessId(currentProcId);    
        if (CustomerStatus.DEACTIVATED.equals(linkedCustomer.getStatus())) {
    	    return true;
        } else {
        	return false;
        }
    }

}

